home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / X11 / extensions / XKB.h < prev    next >
C/C++ Source or Header  |  2006-04-12  |  28KB  |  791 lines

  1. /* $Xorg: XKB.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
  2. /************************************************************
  3. Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
  4.  
  5. Permission to use, copy, modify, and distribute this
  6. software and its documentation for any purpose and without
  7. fee is hereby granted, provided that the above copyright
  8. notice appear in all copies and that both that copyright
  9. notice and this permission notice appear in supporting
  10. documentation, and that the name of Silicon Graphics not be 
  11. used in advertising or publicity pertaining to distribution 
  12. of the software without specific prior written permission.
  13. Silicon Graphics makes no representation about the suitability 
  14. of this software for any purpose. It is provided "as is"
  15. without any express or implied warranty.
  16.  
  17. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
  18. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
  19. AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
  20. GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  21. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
  22. DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
  23. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  24. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  25.  
  26. ********************************************************/
  27. /* $XFree86: xc/include/extensions/XKB.h,v 1.5tsi Exp $ */
  28.  
  29. #ifndef _XKB_H_
  30. #define    _XKB_H_
  31.  
  32.     /*
  33.      * XKB request codes, used in:
  34.      *  -  xkbReqType field of all requests
  35.      *  -  requestMinor field of some events
  36.      */
  37. #define    X_kbUseExtension         0
  38. #define    X_kbSelectEvents          1
  39. #define    X_kbBell             3
  40. #define    X_kbGetState             4
  41. #define    X_kbLatchLockState         5
  42. #define    X_kbGetControls             6
  43. #define    X_kbSetControls             7
  44. #define    X_kbGetMap             8
  45. #define    X_kbSetMap             9
  46. #define    X_kbGetCompatMap        10
  47. #define    X_kbSetCompatMap        11
  48. #define    X_kbGetIndicatorState        12
  49. #define    X_kbGetIndicatorMap        13
  50. #define    X_kbSetIndicatorMap        14
  51. #define    X_kbGetNamedIndicator        15
  52. #define    X_kbSetNamedIndicator        16
  53. #define    X_kbGetNames            17
  54. #define    X_kbSetNames            18
  55. #define    X_kbGetGeometry            19
  56. #define    X_kbSetGeometry            20
  57. #define    X_kbPerClientFlags        21
  58. #define    X_kbListComponents        22
  59. #define    X_kbGetKbdByName        23
  60. #define    X_kbGetDeviceInfo        24
  61. #define    X_kbSetDeviceInfo        25
  62. #define    X_kbSetDebuggingFlags        101
  63.  
  64.     /*
  65.      * In the X sense, XKB reports only one event.
  66.      * The type field of all XKB events is XkbEventCode
  67.      */
  68. #define    XkbEventCode            0
  69. #define    XkbNumberEvents            (XkbEventCode+1)
  70.  
  71.     /*
  72.      * XKB has a minor event code so it can use one X event code for 
  73.      * multiple purposes.  
  74.      *  - reported in the xkbType field of all XKB events.
  75.      *  - XkbSelectEventDetails: Indicates the event for which event details 
  76.      *    are being changed
  77.      */
  78. #define    XkbNewKeyboardNotify        0
  79. #define XkbMapNotify            1
  80. #define    XkbStateNotify            2
  81. #define XkbControlsNotify        3
  82. #define    XkbIndicatorStateNotify        4
  83. #define    XkbIndicatorMapNotify        5
  84. #define    XkbNamesNotify            6
  85. #define XkbCompatMapNotify        7
  86. #define    XkbBellNotify            8
  87. #define    XkbActionMessage        9
  88. #define    XkbAccessXNotify        10
  89. #define    XkbExtensionDeviceNotify    11
  90.  
  91.     /*
  92.      * Event Mask:
  93.      *  - XkbSelectEvents:  Specifies event interest.
  94.      */
  95. #define    XkbNewKeyboardNotifyMask    (1L << 0)
  96. #define XkbMapNotifyMask        (1L << 1)
  97. #define    XkbStateNotifyMask        (1L << 2)
  98. #define XkbControlsNotifyMask        (1L << 3)
  99. #define    XkbIndicatorStateNotifyMask    (1L << 4)
  100. #define    XkbIndicatorMapNotifyMask    (1L << 5)
  101. #define    XkbNamesNotifyMask        (1L << 6)
  102. #define XkbCompatMapNotifyMask        (1L << 7)
  103. #define    XkbBellNotifyMask        (1L << 8)
  104. #define    XkbActionMessageMask        (1L << 9)
  105. #define    XkbAccessXNotifyMask        (1L << 10)
  106. #define    XkbExtensionDeviceNotifyMask    (1L << 11)
  107. #define    XkbAllEventsMask        (0xFFF)
  108.  
  109.     /*
  110.      * NewKeyboardNotify event details:
  111.      */
  112. #define    XkbNKN_KeycodesMask        (1L << 0)
  113. #define    XkbNKN_GeometryMask        (1L << 1)
  114. #define    XkbNKN_DeviceIDMask        (1L << 2)
  115. #define    XkbAllNewKeyboardEventsMask    (0x7)
  116.  
  117.     /*
  118.      * AccessXNotify event types:
  119.      *  - The 'what' field of AccessXNotify events reports the
  120.      *    reason that the event was generated.
  121.      */
  122. #define    XkbAXN_SKPress            0
  123. #define    XkbAXN_SKAccept            1
  124. #define    XkbAXN_SKReject            2
  125. #define    XkbAXN_SKRelease        3
  126. #define    XkbAXN_BKAccept            4
  127. #define    XkbAXN_BKReject            5
  128. #define    XkbAXN_AXKWarning        6
  129.  
  130.     /*
  131.      * AccessXNotify details:
  132.      * - Used as an event detail mask to limit the conditions under which
  133.      *   AccessXNotify events are reported
  134.      */
  135. #define    XkbAXN_SKPressMask        (1L << 0)
  136. #define    XkbAXN_SKAcceptMask        (1L << 1)
  137. #define    XkbAXN_SKRejectMask        (1L << 2)
  138. #define    XkbAXN_SKReleaseMask        (1L << 3)
  139. #define    XkbAXN_BKAcceptMask        (1L << 4)
  140. #define    XkbAXN_BKRejectMask        (1L << 5)
  141. #define    XkbAXN_AXKWarningMask        (1L << 6)
  142. #define    XkbAllAccessXEventsMask        (0xf)
  143.  
  144.     /*
  145.      * Miscellaneous event details:
  146.      * - event detail masks for assorted events that don't reall
  147.      *   have any details.
  148.      */
  149. #define    XkbAllStateEventsMask        XkbAllStateComponentsMask
  150. #define    XkbAllMapEventsMask        XkbAllMapComponentsMask
  151. #define    XkbAllControlEventsMask        XkbAllControlsMask
  152. #define    XkbAllIndicatorEventsMask    XkbAllIndicatorsMask
  153. #define    XkbAllNameEventsMask        XkbAllNamesMask
  154. #define    XkbAllCompatMapEventsMask    XkbAllCompatMask
  155. #define    XkbAllBellEventsMask        (1L << 0)
  156. #define    XkbAllActionMessagesMask    (1L << 0)
  157.  
  158.     /*
  159.      * XKB reports one error:  BadKeyboard
  160.      * A further reason for the error is encoded into to most significant
  161.      * byte of the resourceID for the error:
  162.      *    XkbErr_BadDevice - the device in question was not found
  163.      *    XkbErr_BadClass  - the device was found but it doesn't belong to 
  164.      *                       the appropriate class.
  165.      *    XkbErr_BadId     - the device was found and belongs to the right
  166.      *                       class, but not feedback with a matching id was
  167.      *                       found.
  168.      * The low byte of the resourceID for this error contains the device
  169.      * id, class specifier or feedback id that failed.
  170.      */
  171. #define    XkbKeyboard            0
  172. #define    XkbNumberErrors            1
  173.  
  174. #define    XkbErr_BadDevice    0xff
  175. #define    XkbErr_BadClass        0xfe
  176. #define    XkbErr_BadId        0xfd
  177.  
  178.     /*
  179.      * Keyboard Components Mask:
  180.      * - Specifies the components that follow a GetKeyboardByNameReply
  181.      */
  182. #define    XkbClientMapMask        (1L << 0)
  183. #define    XkbServerMapMask        (1L << 1)
  184. #define    XkbCompatMapMask        (1L << 2)
  185. #define    XkbIndicatorMapMask        (1L << 3)
  186. #define    XkbNamesMask            (1L << 4)
  187. #define    XkbGeometryMask            (1L << 5)
  188. #define    XkbControlsMask            (1L << 6)
  189. #define    XkbAllComponentsMask        (0x7f)
  190.  
  191.     /*
  192.      * State detail mask:
  193.      *  - The 'changed' field of StateNotify events reports which of
  194.      *    the keyboard state components have changed.
  195.      *  - Used as an event detail mask to limit the conditions under
  196.      *    which StateNotify events are reported.
  197.      */
  198. #define    XkbModifierStateMask        (1L << 0)
  199. #define    XkbModifierBaseMask        (1L << 1)
  200. #define    XkbModifierLatchMask        (1L << 2)
  201. #define    XkbModifierLockMask        (1L << 3)
  202. #define    XkbGroupStateMask        (1L << 4)
  203. #define    XkbGroupBaseMask        (1L << 5)
  204. #define    XkbGroupLatchMask        (1L << 6)
  205. #define XkbGroupLockMask        (1L << 7)
  206. #define    XkbCompatStateMask        (1L << 8)
  207. #define    XkbGrabModsMask            (1L << 9)
  208. #define    XkbCompatGrabModsMask        (1L << 10)
  209. #define    XkbLookupModsMask        (1L << 11)
  210. #define    XkbCompatLookupModsMask        (1L << 12)
  211. #define    XkbPointerButtonMask        (1L << 13)
  212. #define    XkbAllStateComponentsMask    (0x3fff)
  213.  
  214.     /*
  215.      * Controls detail masks:
  216.      *  The controls specified in XkbAllControlsMask:
  217.      *  - The 'changed' field of ControlsNotify events reports which of 
  218.      *    the keyboard controls have changed.
  219.      *  - The 'changeControls' field of the SetControls request specifies
  220.      *    the controls for which values are to be changed.
  221.      *  - Used as an event detail mask to limit the conditions under 
  222.      *    which ControlsNotify events are reported.
  223.      *
  224.      *  The controls specified in the XkbAllBooleanCtrlsMask:
  225.      *  - The 'enabledControls' field of ControlsNotify events reports the
  226.      *    current status of the boolean controls.
  227.      *  - The 'enabledControlsChanges' field of ControlsNotify events reports
  228.      *    any boolean controls that have been turned on or off.
  229.      *  - The 'affectEnabledControls' and 'enabledControls' fields of the
  230.      *    kbSetControls request change the set of enabled controls.
  231.      *  - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
  232.      *    an XkbControlsRec specify the controls to be changed if the keyboard
  233.      *    times out and the values to which they should be changed.
  234.      *  - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags 
  235.      *    request specifies the specify the controls to be reset when the
  236.      *    client exits and the values to which they should be reset.
  237.      *  - The 'ctrls' field of an indicator map specifies the controls
  238.      *    that drive the indicator.
  239.      *  - Specifies the boolean controls affected by the SetControls and
  240.      *    LockControls key actions.
  241.      */
  242. #define    XkbRepeatKeysMask     (1L << 0)
  243. #define    XkbSlowKeysMask         (1L << 1)
  244. #define    XkbBounceKeysMask     (1L << 2)
  245. #define    XkbStickyKeysMask     (1L << 3)
  246. #define    XkbMouseKeysMask     (1L << 4)
  247. #define    XkbMouseKeysAccelMask     (1L << 5)
  248. #define    XkbAccessXKeysMask     (1L << 6)
  249. #define    XkbAccessXTimeoutMask     (1L << 7)
  250. #define    XkbAccessXFeedbackMask     (1L << 8)
  251. #define    XkbAudibleBellMask     (1L << 9)
  252. #define    XkbOverlay1Mask         (1L << 10)
  253. #define    XkbOverlay2Mask         (1L << 11)
  254. #define    XkbIgnoreGroupLockMask     (1L << 12)
  255. #define    XkbGroupsWrapMask     (1L << 27)
  256. #define    XkbInternalModsMask     (1L << 28)
  257. #define    XkbIgnoreLockModsMask     (1L << 29)
  258. #define    XkbPerKeyRepeatMask     (1L << 30)
  259. #define    XkbControlsEnabledMask     (1L << 31)
  260.  
  261. #define    XkbAccessXOptionsMask    (XkbStickyKeysMask|XkbAccessXFeedbackMask)
  262.  
  263. #define    XkbAllBooleanCtrlsMask     (0x00001FFF)
  264. #define    XkbAllControlsMask     (0xF8001FFF)
  265. #define    XkbAllControlEventsMask     XkbAllControlsMask
  266.  
  267.     /*
  268.      * AccessX Options Mask
  269.      *  - The 'accessXOptions' field of an XkbControlsRec specifies the
  270.      *    AccessX options that are currently in effect.
  271.      *  - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
  272.      *    fields of an XkbControlsRec specify the Access X options to be 
  273.      *    changed if the keyboard times out and the values to which they 
  274.      *    should be changed.
  275.      */
  276. #define    XkbAX_SKPressFBMask    (1L << 0)
  277. #define    XkbAX_SKAcceptFBMask    (1L << 1)
  278. #define    XkbAX_FeatureFBMask    (1L << 2)
  279. #define    XkbAX_SlowWarnFBMask    (1L << 3)
  280. #define    XkbAX_IndicatorFBMask    (1L << 4)
  281. #define    XkbAX_StickyKeysFBMask    (1L << 5)
  282. #define    XkbAX_TwoKeysMask    (1L << 6)
  283. #define    XkbAX_LatchToLockMask    (1L << 7)
  284. #define    XkbAX_SKReleaseFBMask    (1L << 8)
  285. #define    XkbAX_SKRejectFBMask    (1L << 9)
  286. #define    XkbAX_BKRejectFBMask    (1L << 10)
  287. #define    XkbAX_DumbBellFBMask    (1L << 11)
  288. #define    XkbAX_FBOptionsMask    (0xF3F)
  289. #define    XkbAX_SKOptionsMask    (0x0C0)
  290. #define    XkbAX_AllOptionsMask    (0xFFF)
  291.  
  292.     /*
  293.      * XkbUseCoreKbd is used to specify the core keyboard without having
  294.      *             to look up its X input extension identifier.
  295.      * XkbUseCorePtr is used to specify the core pointer without having
  296.      *            to look up its X input extension identifier.
  297.      * XkbDfltXIClass is used to specify "don't care" any place that the
  298.      *            XKB protocol is looking for an X Input Extension 
  299.      *            device class.
  300.      * XkbDfltXIId is used to specify "don't care" any place that the
  301.      *            XKB protocol is looking for an X Input Extension
  302.      *            feedback identifier.
  303.      * XkbAllXIClasses is used to get information about all device indicators,
  304.      *            whether they're part of the indicator feedback class
  305.      *            or the keyboard feedback class.
  306.      * XkbAllXIIds is used to get information about all device indicator
  307.      *            feedbacks without having to list them.
  308.      * XkbXINone is used to indicate that no class or id has been specified.
  309.      * XkbLegalXILedClass(c)  True if 'c' specifies a legal class with LEDs
  310.      * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
  311.      * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
  312.      * XkbExplicitXIClass(c)  True if 'c' explicitly specifies a device class
  313.      * XkbExplicitXIId(c)     True if 'i' explicitly specifies a device id
  314.      * XkbSingleXIClass(c)    True if 'c' specifies exactly one device class, 
  315.      *                        including the default.
  316.      * XkbSingleXIId(i)       True if 'i' specifies exactly one device 
  317.      *                          identifier, including the default.
  318.      */
  319. #define    XkbUseCoreKbd        0x0100
  320. #define    XkbUseCorePtr        0x0200
  321. #define    XkbDfltXIClass        0x0300
  322. #define    XkbDfltXIId        0x0400
  323. #define    XkbAllXIClasses        0x0500
  324. #define    XkbAllXIIds        0x0600
  325. #define    XkbXINone        0xff00
  326.  
  327. #define    XkbLegalXILedClass(c)    (((c)==KbdFeedbackClass)||\
  328.                     ((c)==LedFeedbackClass)||\
  329.                     ((c)==XkbDfltXIClass)||\
  330.                     ((c)==XkbAllXIClasses))
  331. #define    XkbLegalXIBellClass(c)    (((c)==KbdFeedbackClass)||\
  332.                     ((c)==BellFeedbackClass)||\
  333.                     ((c)==XkbDfltXIClass)||\
  334.                     ((c)==XkbAllXIClasses))
  335. #define    XkbExplicitXIDevice(c)    (((c)&(~0xff))==0)
  336. #define    XkbExplicitXIClass(c)    (((c)&(~0xff))==0)
  337. #define    XkbExplicitXIId(c)    (((c)&(~0xff))==0)
  338. #define    XkbSingleXIClass(c)    ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
  339. #define    XkbSingleXIId(c)    ((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
  340.  
  341. #define    XkbNoModifier        0xff
  342. #define    XkbNoShiftLevel        0xff
  343. #define    XkbNoShape        0xff
  344. #define    XkbNoIndicator        0xff
  345.  
  346. #define    XkbNoModifierMask    0
  347. #define    XkbAllModifiersMask    0xff
  348. #define    XkbAllVirtualModsMask    0xffff
  349.  
  350. #define    XkbNumKbdGroups        4
  351. #define    XkbMaxKbdGroup        (XkbNumKbdGroups-1)
  352.  
  353. #define    XkbMaxMouseKeysBtn    4
  354.  
  355.     /*
  356.      * Group Index and Mask:
  357.      *  - Indices into the kt_index array of a key type.
  358.      *  - Mask specifies types to be changed for XkbChangeTypesOfKey
  359.      */
  360. #define    XkbGroup1Index        0
  361. #define    XkbGroup2Index        1
  362. #define    XkbGroup3Index        2
  363. #define    XkbGroup4Index        3
  364. #define    XkbAnyGroup        254
  365. #define    XkbAllGroups        255
  366.  
  367. #define    XkbGroup1Mask        (1<<0)
  368. #define    XkbGroup2Mask        (1<<1)
  369. #define    XkbGroup3Mask        (1<<2)
  370. #define    XkbGroup4Mask        (1<<3)
  371. #define    XkbAnyGroupMask        (1<<7)
  372. #define    XkbAllGroupsMask    (0xf)
  373.  
  374.     /*
  375.      * BuildCoreState: Given a keyboard group and a modifier state,
  376.      *                 construct the value to be reported an event.
  377.      * GroupForCoreState:  Given the state reported in an event,
  378.      *                 determine the keyboard group.
  379.      * IsLegalGroup:   Returns TRUE if 'g' is a valid group index.
  380.      */
  381. #define    XkbBuildCoreState(m,g)    ((((g)&0x3)<<13)|((m)&0xff))
  382. #define XkbGroupForCoreState(s)    (((s)>>13)&0x3)
  383. #define    XkbIsLegalGroup(g)    (((g)>=0)&&((g)<XkbNumKbdGroups))
  384.  
  385.     /*
  386.      * GroupsWrap values:
  387.      *  - The 'groupsWrap' field of an XkbControlsRec specifies the
  388.      *    treatment of out of range groups.
  389.      *  - Bits 6 and 7 of the group info field of a key symbol map
  390.      *    specify the interpretation of out of range groups for the
  391.      *    corresponding key.
  392.      */
  393. #define    XkbWrapIntoRange    (0x00)
  394. #define    XkbClampIntoRange    (0x40)
  395. #define    XkbRedirectIntoRange    (0x80)
  396.  
  397.     /*
  398.      * Action flags:  Reported in the 'flags' field of most key actions.
  399.      * Interpretation depends on the type of the action; not all actions
  400.      * accept all flags.
  401.      *
  402.      * Option            Used for Actions
  403.      * ------            ----------------
  404.      * ClearLocks        SetMods, LatchMods, SetGroup, LatchGroup
  405.      * LatchToLock        SetMods, LatchMods, SetGroup, LatchGroup
  406.      * LockNoLock        LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
  407.      * LockNoUnlock        LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
  408.      * UseModMapMods        SetMods, LatchMods, LockMods, ISOLock
  409.      * GroupAbsolute        SetGroup, LatchGroup, LockGroup, ISOLock
  410.      * UseDfltButton        PtrBtn, LockPtrBtn
  411.      * NoAcceleration        MovePtr
  412.      * MoveAbsoluteX        MovePtr
  413.      * MoveAbsoluteY        MovePtr
  414.      * ISODfltIsGroup        ISOLock
  415.      * ISONoAffectMods        ISOLock
  416.      * ISONoAffectGroup        ISOLock
  417.      * ISONoAffectPtr        ISOLock
  418.      * ISONoAffectCtrls        ISOLock
  419.      * MessageOnPress        ActionMessage
  420.      * MessageOnRelease        ActionMessage
  421.      * MessageGenKeyEvent    ActionMessage
  422.      * AffectDfltBtn        SetPtrDflt
  423.      * DfltBtnAbsolute        SetPtrDflt
  424.      * SwitchApplication    SwitchScreen
  425.      * SwitchAbsolute        SwitchScreen
  426.      */
  427.  
  428. #define    XkbSA_ClearLocks    (1L << 0)
  429. #define    XkbSA_LatchToLock    (1L << 1)
  430.  
  431. #define    XkbSA_LockNoLock    (1L << 0)
  432. #define    XkbSA_LockNoUnlock    (1L << 1)
  433.  
  434. #define    XkbSA_UseModMapMods    (1L << 2)
  435.  
  436. #define    XkbSA_GroupAbsolute    (1L << 2)
  437. #define    XkbSA_UseDfltButton    0
  438.  
  439. #define    XkbSA_NoAcceleration    (1L << 0)
  440. #define    XkbSA_MoveAbsoluteX    (1L << 1)
  441. #define    XkbSA_MoveAbsoluteY    (1L << 2)
  442.  
  443. #define    XkbSA_ISODfltIsGroup      (1L << 7)
  444. #define    XkbSA_ISONoAffectMods     (1L << 6)
  445. #define    XkbSA_ISONoAffectGroup     (1L << 5)
  446. #define    XkbSA_ISONoAffectPtr     (1L << 4)
  447. #define    XkbSA_ISONoAffectCtrls     (1L << 3)
  448. #define    XkbSA_ISOAffectMask     (0x78)
  449.  
  450. #define    XkbSA_MessageOnPress     (1L << 0)
  451. #define    XkbSA_MessageOnRelease     (1L << 1)
  452. #define    XkbSA_MessageGenKeyEvent (1L << 2)
  453.  
  454. #define    XkbSA_AffectDfltBtn    1
  455. #define    XkbSA_DfltBtnAbsolute    (1L << 2)
  456.  
  457. #define    XkbSA_SwitchApplication    (1L << 0)
  458. #define    XkbSA_SwitchAbsolute    (1L << 2)
  459.  
  460.     /*
  461.      * The following values apply to the SA_DeviceValuator 
  462.      * action only.  Valuator operations specify the action 
  463.      * to be taken.   Values specified in the action are 
  464.      * multiplied by 2^scale before they are applied.
  465.      */
  466. #define    XkbSA_IgnoreVal        (0x00)
  467. #define    XkbSA_SetValMin        (0x10)
  468. #define    XkbSA_SetValCenter    (0x20)
  469. #define    XkbSA_SetValMax        (0x30)
  470. #define    XkbSA_SetValRelative    (0x40)
  471. #define    XkbSA_SetValAbsolute    (0x50)
  472. #define    XkbSA_ValOpMask        (0x70)
  473. #define    XkbSA_ValScaleMask    (0x07)
  474. #define    XkbSA_ValOp(a)        ((a)&XkbSA_ValOpMask)
  475. #define    XkbSA_ValScale(a)    ((a)&XkbSA_ValScaleMask)
  476.  
  477.     /*
  478.      * Action types: specifies the type of a key action.  Reported in the
  479.      * type field of all key actions.
  480.      */
  481. #define    XkbSA_NoAction        0x00
  482. #define    XkbSA_SetMods        0x01
  483. #define    XkbSA_LatchMods        0x02
  484. #define    XkbSA_LockMods        0x03
  485. #define    XkbSA_SetGroup        0x04
  486. #define    XkbSA_LatchGroup    0x05
  487. #define    XkbSA_LockGroup        0x06
  488. #define    XkbSA_MovePtr        0x07
  489. #define    XkbSA_PtrBtn        0x08
  490. #define    XkbSA_LockPtrBtn    0x09
  491. #define    XkbSA_SetPtrDflt    0x0a
  492. #define    XkbSA_ISOLock        0x0b
  493. #define    XkbSA_Terminate        0x0c
  494. #define    XkbSA_SwitchScreen    0x0d
  495. #define    XkbSA_SetControls    0x0e
  496. #define    XkbSA_LockControls    0x0f
  497. #define    XkbSA_ActionMessage    0x10
  498. #define    XkbSA_RedirectKey    0x11
  499. #define    XkbSA_DeviceBtn        0x12
  500. #define    XkbSA_LockDeviceBtn    0x13
  501. #define    XkbSA_DeviceValuator    0x14
  502. #define    XkbSA_LastAction    XkbSA_DeviceValuator
  503. #define    XkbSA_NumActions    (XkbSA_LastAction+1)
  504.  
  505. #if defined(XF86DDXACTIONS) || defined(XFree86Server)
  506. #define    XkbSA_XFree86Private    0x86
  507. #endif
  508.  
  509.     /*
  510.      * Specifies the key actions that clear latched groups or modifiers.
  511.      */
  512. #define    XkbSA_BreakLatch \
  513.     ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
  514.     (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
  515.     (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
  516.     (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
  517.      
  518.     /*
  519.      * Macros to classify key actions
  520.      */
  521. #define    XkbIsModAction(a)    (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
  522. #define    XkbIsGroupAction(a)    (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
  523. #define    XkbIsPtrAction(a)    (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
  524.  
  525.  
  526.     /*
  527.      * Key Behavior Qualifier:
  528.      *    KB_Permanent indicates that the behavior describes an unalterable
  529.      *    characteristic of the keyboard, not an XKB software-simulation of
  530.      *    the listed behavior.
  531.      * Key Behavior Types:  
  532.      *    Specifies the behavior of the underlying key.
  533.      */
  534. #define    XkbKB_Permanent        0x80
  535. #define    XkbKB_OpMask        0x7f
  536.  
  537. #define    XkbKB_Default        0x00
  538. #define    XkbKB_Lock        0x01
  539. #define    XkbKB_RadioGroup    0x02
  540. #define    XkbKB_Overlay1        0x03
  541. #define    XkbKB_Overlay2        0x04
  542.  
  543. #define    XkbKB_RGAllowNone    0x80
  544.  
  545.     /*
  546.      * Various macros which describe the range of legal keycodes.
  547.      */
  548. #define    XkbMinLegalKeyCode    8
  549. #define    XkbMaxLegalKeyCode    255
  550. #define    XkbMaxKeyCount        (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1)
  551. #define    XkbPerKeyBitArraySize    ((XkbMaxLegalKeyCode+1)/8)
  552. /* Seems kinda silly to check that an unsigned char is <= 255... */
  553. #define    XkbIsLegalKeycode(k)    ((k)>=XkbMinLegalKeyCode)
  554.  
  555.     /*
  556.      * Assorted constants and limits.
  557.      */
  558. #define    XkbNumModifiers        8
  559. #define    XkbNumVirtualMods    16
  560. #define    XkbNumIndicators    32
  561. #define    XkbAllIndicatorsMask    (0xffffffff)
  562. #define    XkbMaxRadioGroups    32
  563. #define    XkbAllRadioGroupsMask    (0xffffffff)
  564. #define    XkbMaxShiftLevel    63
  565. #define    XkbMaxSymsPerKey    (XkbMaxShiftLevel*XkbNumKbdGroups)
  566. #define    XkbRGMaxMembers        12
  567. #define    XkbActionMessageLength    6
  568. #define    XkbKeyNameLength    4
  569. #define    XkbMaxRedirectCount    8
  570.  
  571. #define    XkbGeomPtsPerMM        10
  572. #define    XkbGeomMaxColors    32
  573. #define    XkbGeomMaxLabelColors    3
  574. #define    XkbGeomMaxPriority    255
  575.  
  576.     /*
  577.      * Key Type index and mask for the four standard key types.
  578.      */
  579. #define    XkbOneLevelIndex    0
  580. #define    XkbTwoLevelIndex    1
  581. #define    XkbAlphabeticIndex    2
  582. #define    XkbKeypadIndex        3
  583. #define    XkbLastRequiredType    XkbKeypadIndex
  584. #define    XkbNumRequiredTypes    (XkbLastRequiredType+1)
  585. #define    XkbMaxKeyTypes        255
  586.  
  587. #define    XkbOneLevelMask        (1<<0)
  588. #define    XkbTwoLevelMask        (1<<1)
  589. #define    XkbAlphabeticMask    (1<<2)
  590. #define    XkbKeypadMask        (1<<3)
  591. #define    XkbAllRequiredTypes    (0xf)
  592.  
  593. #define    XkbShiftLevel(n)    ((n)-1)
  594. #define    XkbShiftLevelMask(n)    (1<<((n)-1))
  595.  
  596.     /*
  597.      * Extension name and version information
  598.      */
  599. #define    XkbName "XKEYBOARD"
  600. #define    XkbMajorVersion    1
  601. #define    XkbMinorVersion    0
  602.  
  603.     /*
  604.      * Explicit map components:
  605.      *  - Used in the 'explicit' field of an XkbServerMap.  Specifies
  606.      *    the keyboard components that should _not_ be updated automatically
  607.      *    in response to core protocol keyboard mapping requests.
  608.      */
  609. #define    XkbExplicitKeyTypesMask      (0x0f)
  610. #define    XkbExplicitKeyType1Mask      (1<<0)
  611. #define    XkbExplicitKeyType2Mask      (1<<1)
  612. #define    XkbExplicitKeyType3Mask      (1<<2)
  613. #define    XkbExplicitKeyType4Mask      (1<<3)
  614. #define    XkbExplicitInterpretMask  (1<<4)
  615. #define    XkbExplicitAutoRepeatMask (1<<5)
  616. #define    XkbExplicitBehaviorMask      (1<<6)
  617. #define    XkbExplicitVModMapMask      (1<<7)
  618. #define    XkbAllExplicitMask      (0xff)
  619.  
  620.     /*
  621.      * Map components masks:
  622.      * Those in AllMapComponentsMask:
  623.      *  - Specifies the individual fields to be loaded or changed for the
  624.      *    GetMap and SetMap requests.
  625.      * Those in ClientInfoMask:
  626.      *  - Specifies the components to be allocated by XkbAllocClientMap.
  627.      * Those in ServerInfoMask:
  628.      *  - Specifies the components to be allocated by XkbAllocServerMap.
  629.      */
  630. #define    XkbKeyTypesMask        (1<<0)
  631. #define    XkbKeySymsMask        (1<<1)
  632. #define    XkbModifierMapMask    (1<<2)
  633. #define    XkbExplicitComponentsMask (1<<3)
  634. #define XkbKeyActionsMask    (1<<4)
  635. #define    XkbKeyBehaviorsMask    (1<<5)
  636. #define    XkbVirtualModsMask    (1<<6)
  637. #define    XkbVirtualModMapMask    (1<<7)
  638.  
  639. #define    XkbAllClientInfoMask    (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask)
  640. #define    XkbAllServerInfoMask    (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask)
  641. #define    XkbAllMapComponentsMask    (XkbAllClientInfoMask|XkbAllServerInfoMask)
  642.  
  643.     /*
  644.      * Symbol interpretations flags:
  645.      *  - Used in the flags field of a symbol interpretation
  646.      */
  647. #define    XkbSI_AutoRepeat    (1<<0)
  648. #define    XkbSI_LockingKey    (1<<1)
  649.  
  650.     /*
  651.      * Symbol interpretations match specification:
  652.      *  - Used in the match field of a symbol interpretation to specify 
  653.      *    the conditions under which an interpretation is used.
  654.      */
  655. #define    XkbSI_LevelOneOnly    (0x80)
  656. #define    XkbSI_OpMask        (0x7f)
  657. #define    XkbSI_NoneOf        (0)
  658. #define    XkbSI_AnyOfOrNone    (1)
  659. #define    XkbSI_AnyOf        (2)
  660. #define    XkbSI_AllOf        (3)
  661. #define    XkbSI_Exactly        (4)
  662.  
  663.     /*
  664.      * Indicator map flags:
  665.      *  - Used in the flags field of an indicator map to indicate the
  666.      *    conditions under which and indicator can be changed and the
  667.      *    effects of changing the indicator.
  668.      */
  669. #define    XkbIM_NoExplicit    (1L << 7)
  670. #define    XkbIM_NoAutomatic    (1L << 6)
  671. #define    XkbIM_LEDDrivesKB    (1L << 5)
  672.  
  673.     /*
  674.      * Indicator map component specifications:
  675.      *  - Used by the 'which_groups' and 'which_mods' fields of an indicator
  676.      *    map to specify which keyboard components should be used to drive
  677.      *    the indicator.
  678.      */
  679. #define    XkbIM_UseBase        (1L << 0)
  680. #define    XkbIM_UseLatched    (1L << 1)
  681. #define    XkbIM_UseLocked        (1L << 2)
  682. #define    XkbIM_UseEffective    (1L << 3)
  683. #define    XkbIM_UseCompat        (1L << 4)
  684.  
  685. #define    XkbIM_UseNone      0
  686. #define    XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\
  687.                            |XkbIM_UseEffective)
  688. #define    XkbIM_UseAnyMods  (XkbIM_UseAnyGroup|XkbIM_UseCompat)
  689.  
  690.     /*
  691.      * Compatibility Map Compontents:
  692.      *  - Specifies the components to be allocated in XkbAllocCompatMap.
  693.      */
  694. #define    XkbSymInterpMask    (1<<0)
  695. #define    XkbGroupCompatMask    (1<<1)
  696. #define    XkbAllCompatMask    (0x3)
  697.  
  698.     /*
  699.      * Names component mask:
  700.      *  - Specifies the names to be loaded or changed for the GetNames and
  701.      *    SetNames requests.
  702.      *  - Specifies the names that have changed in a NamesNotify event.
  703.      *  - Specifies the names components to be allocated by XkbAllocNames.
  704.      */
  705. #define    XkbKeycodesNameMask    (1<<0)
  706. #define    XkbGeometryNameMask    (1<<1)
  707. #define    XkbSymbolsNameMask    (1<<2)
  708. #define    XkbPhysSymbolsNameMask    (1<<3)
  709. #define    XkbTypesNameMask    (1<<4)
  710. #define    XkbCompatNameMask     (1<<5)
  711. #define    XkbKeyTypeNamesMask    (1<<6)
  712. #define    XkbKTLevelNamesMask    (1<<7)
  713. #define    XkbIndicatorNamesMask    (1<<8)
  714. #define    XkbKeyNamesMask        (1<<9)
  715. #define    XkbKeyAliasesMask    (1<<10)
  716. #define    XkbVirtualModNamesMask    (1<<11)
  717. #define    XkbGroupNamesMask    (1<<12)
  718. #define    XkbRGNamesMask        (1<<13)
  719. #define    XkbComponentNamesMask    (0x3f)
  720. #define    XkbAllNamesMask        (0x3fff)
  721.  
  722.     /*
  723.      * GetByName components:
  724.      *  - Specifies desired or necessary components to GetKbdByName request.
  725.      *  - Reports the components that were found in a GetKbdByNameReply
  726.      */
  727. #define    XkbGBN_TypesMask        (1L << 0)
  728. #define    XkbGBN_CompatMapMask        (1L << 1)
  729. #define    XkbGBN_ClientSymbolsMask    (1L << 2)
  730. #define    XkbGBN_ServerSymbolsMask    (1L << 3)
  731. #define    XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask)
  732. #define    XkbGBN_IndicatorMapMask        (1L << 4)
  733. #define    XkbGBN_KeyNamesMask        (1L << 5)
  734. #define    XkbGBN_GeometryMask        (1L << 6)
  735. #define    XkbGBN_OtherNamesMask        (1L << 7)
  736. #define    XkbGBN_AllComponentsMask    (0xff)
  737.  
  738.      /*
  739.       * ListComponents flags
  740.       */
  741. #define    XkbLC_Hidden            (1L <<  0)
  742. #define    XkbLC_Default            (1L <<  1)
  743. #define    XkbLC_Partial            (1L <<  2)
  744.  
  745. #define    XkbLC_AlphanumericKeys        (1L <<  8)
  746. #define    XkbLC_ModifierKeys        (1L <<  9)
  747. #define    XkbLC_KeypadKeys        (1L << 10)
  748. #define    XkbLC_FunctionKeys        (1L << 11)
  749. #define    XkbLC_AlternateGroup        (1L << 12)
  750.  
  751.     /*
  752.      * X Input Extension Interactions
  753.      * - Specifies the possible interactions between XKB and the X input
  754.      *   extension
  755.      * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
  756.      *   XKB information about an extension device.
  757.      * - Reports the list of supported optional features in the reply to
  758.      *   XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
  759.      * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
  760.      * events to indicate an attempt to use an unsupported feature.
  761.      */
  762. #define    XkbXI_KeyboardsMask        (1L << 0)
  763. #define    XkbXI_ButtonActionsMask        (1L << 1)
  764. #define    XkbXI_IndicatorNamesMask    (1L << 2)
  765. #define    XkbXI_IndicatorMapsMask        (1L << 3)
  766. #define    XkbXI_IndicatorStateMask    (1L << 4)
  767. #define    XkbXI_UnsupportedFeatureMask    (1L << 15)
  768. #define    XkbXI_AllFeaturesMask        (0x001f)
  769. #define    XkbXI_AllDeviceFeaturesMask    (0x001e)
  770.  
  771. #define    XkbXI_IndicatorsMask        (0x001c)
  772. #define    XkbAllExtensionDeviceEventsMask (0x801f)
  773.  
  774.     /*
  775.      * Per-Client Flags:
  776.      *  - Specifies flags to be changed by the PerClientFlags request.
  777.      */
  778. #define    XkbPCF_DetectableAutoRepeatMask    (1L << 0)
  779. #define    XkbPCF_GrabsUseXKBStateMask    (1L << 1)
  780. #define    XkbPCF_AutoResetControlsMask    (1L << 2)
  781. #define    XkbPCF_LookupStateWhenGrabbed    (1L << 3)
  782. #define    XkbPCF_SendEventUsesXKBState    (1L << 4)
  783. #define    XkbPCF_AllFlagsMask        (0x1F)
  784.  
  785.     /*
  786.      * Debugging flags and controls
  787.      */
  788. #define    XkbDF_DisableLocks    (1<<0)
  789.  
  790. #endif /* _XKB_H_ */
  791.